home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
Celestin Apprentice 5
/
Apprentice-Release5.iso
/
Source Code
/
C
/
Frameworks
/
Recursive Shell 1.0.1
/
Recursive Shell ƒ
/
DialogUtil.c
next >
Wrap
Text File
|
1996-06-14
|
2KB
|
88 lines
/*****************************************************************************/
//
// DialogUtil.c
//
// Various utility functions for displaying and handling dialog boxes.
//
// Version 1.0
//
// Created: 13 May 1996
// Modified: 14 June 1996
//
/*****************************************************************************/
// Actually, put these in the Utilities.c file...
#include "DialogUtil.h"
#define kEmptyString "\p"
#define kMoveToFront (WindowPtr)-1L
#define kNilFilterProc nil
#define kBaseResID 700
#define kErrorResID kBaseResID
#define kAboutResID kBaseResID
//
// DisplayFatalError
// Display a stop alert box with a single text string, then quit
void DisplayFatalError( Str255 errorString )
{
ParamText( errorString, kEmptyString, kEmptyString, kEmptyString );
StopAlert( kErrorResID, kNilFilterProc );
ExitToShell();
}
//
// DisplayAlert
//
void DisplayAlert( Str255 errorString )
{
ParamText( errorString, kEmptyString, kEmptyString, kEmptyString );
StopAlert( kErrorResID, kNilFilterProc );
}
//
// ShowAboutBox
//
void ShowAboutBox( void )
{
DialogPtr myDialog;
/* De-hilight the Apple menu */
HiliteMenu( 0 );
myDialog = GetNewDialog( kAboutResID, nil, kMoveToFront );
ShowWindow( myDialog );
DrawDialog( myDialog );
/* Wait until the user releases the mouse button.
* If the user holds down the mouse when a click causes a message to be displayed,
* we must wait until they release the button before checking for a click (see below)
* to clear the dialog - so they at least have a chance to see it.
* NOTE THE SEMICOLON!
* This is a loop which waits until the mouse button is not down.
*/
while ( Button() );
/* Now, wait until the user clicks:
* NOTE THE SEMICOLON!
* This is a loop which waits until the mouse is clicked.
*/
while ( ! Button() );
/* Wait until the user releases the mouse button.
* It seems a little funny to have the dialog go away on mouseDown.
* This makes it seem more like a mouseUp thing.
* NOTE THE SEMICOLON!
* This is a loop which waits until the mouse button is not down.
*/
while ( Button() );
/* clear the event queue so the click doesn't do anything: */
FlushEvents( everyEvent, 0 );
DisposeDialog( myDialog ); /* Get rid of the dialog */
}